package com.caiying.dota.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ApplicationContextUtil extends ApplicationObjectSupport{
	private static ApplicationContextUtil ApplicationContextUtil = null;
	private ApplicationContext applicationContext = null;

	private ApplicationContextUtil(){
		applicationContext = getApplicationContext();
	}
	
	public static ApplicationContextUtil getInstance(){
		if(ApplicationContextUtil == null){
			ApplicationContextUtil = new ApplicationContextUtil();
		}
		return ApplicationContextUtil;
	}
	
	public ApplicationContext getAppContext(){
		if(applicationContext == null){
			applicationContext = new ClassPathXmlApplicationContext("beans.xml");
		}
		return applicationContext;
	}
}
